/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package Pojos;

import java.io.Serializable;

/**
 *
 * @author Ech Con
 */
public class GioHang implements Serializable {
    private SanPham sp;
    private int soLuong;
    private double thanhTien;

    /**
     * @return the SanPham
     */
    public SanPham getSp() {
        return sp;
    }

    /**
     * @param sach the SanPham to set
     */
    public void setSp(SanPham sp) {
        this.sp = sp;
    }
    /**
     * @return the soLuong
     */
    public int getSoLuong() {
        return soLuong;
    }

    /**
     * @param soLuong the soLuong to set
     */
    public void setSoLuong(int soLuong) {
        this.soLuong = soLuong;
        thanhTien = soLuong * sp.getGiaBan();
    }

    /**
     * Hàm khởi tạo mặc định
     */
    public GioHang(){
        sp = new SanPham();
        soLuong = 0;
        thanhTien = 0.0;
    }

    

    /**
     * Hàm khởi tạo đầy đủ tham số
     * @param sp
     * @param soLuong
     */
    public GioHang(SanPham sp, int soLuong){
        this.sp = sp;
        this.soLuong = soLuong;
        thanhTien = sp.getGiaBan() * soLuong;
    }

    /**
     * @return the thanhTien
     */
    public double getThanhTien() {
        return thanhTien;
    }
}
